<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title>外勤查询</title>
    <link rel="stylesheet" type="text/css" href="mode/weui/weui.min.css"/>
    <link rel="stylesheet" type="text/css" href="web/res/fontawesome/css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="webmain/css/rui.css">
    <script type="text/javascript" src="js/base64-min.js"></script>

    <script type="text/javascript" src="webmain/we/ying/dist/jquery.min.js"></script>
    <script type="text/javascript" src="webmain/we/ying/ying.js"></script>

    <script type="text/javascript" src="webmain/we/ying/dist/dropload.js"></script>
    <script type="text/javascript" src="webmain/we/ying/dist/dropload.min.js"></script>
    <link rel="stylesheet" href="webmain/we/ying/dist/dropload.css">
    <style>

        body,html{background-color:#f1f1f1;}

        .weui_tab{position:fixed;bottom:0px;width:100%;height:50px}
        .weui_navbar_item{font-size:16px;}
        .weui_navbar_item span{position:absolute;left:3px;top:3px}
        .weui_navbar_item:active{background-color:#f5f5f5}

        body,html{
            height: 100%;
            background-color: rgb(230,230,230);
        }
        ul li{width:90%; margin-left: 5%; margin-bottom: 20px; border-radius:5px; display: flex;flex-direction:column; background-color: white;margin-top: 10px}
        .div1{justify-content: space-between; display:flex; border-radius: 5px 5px 0px 0px; background-color: rgb(27,205,138)}

        .div2{display: flex;flex-direction:row; border: 1px rgb(223,223,223) solid; border-bottom: 1px; border-left: 0px;border-right: 0px; padding:3px 10px;justify-content: space-between;}

    </style>
    <script>

        var json;

        var mid = GetQueryStrings("uid");
        var page = 0;

        var d = new Date;

        var day=d.getDate()

        var month=d.getMonth() + 1

        var year=d.getFullYear()

        var timecurrent = year + "-" + month + "-" + day;

        var sincetime = "2017-08-01";

        var tmp = timecurrent.split("-");

        var T1 = new Date(tmp[0],tmp[1]-1,tmp[2]);

        tmp = sincetime.split("-");

        var T2 = new Date(tmp[0],tmp[1]-1,tmp[2]);

        var sincedays = days(T1,T2);


        function days(t1,t2) {

            return (t1.getTime() - t2.getTime())/60/60/24/1000
        }

        var ulhtml = '';





        function load(){

            dropload = $('.element').dropload({

                scrollArea : window,

                loadDownFn : function(me){

                    $.ajax({

                        type: 'POST',
                       // url: "http://oa.wxlion.com/index.php?a=detail&m=wq&d=we",
                         url: "http://localhost/oa/public_html/index.php?a=detail&m=wq&d=we",

                        data: {

                            page:page++,
                            uid:mid
                        },
                        datatype: "json",

                        success: function(result) {

                            var arr = eval(result);

                            json = arr;

                            lowwq();

                            me.resetload();    // 每次数据加载完，必须重置


                            if(json.length < 5){

                                dropload.lock('down');
                                me.noData();
                                me.resetload();

                            }

                        },
                        //调用出错执行的函数
                        error: function(error1) {

                        }
                    });

                }

            });
        }



        function lowwq() {



            for (var i =0;i<json.length;i++){

                var j = json[i];

                var time = j.optdt.substring(0,10);
                var time1 = j.optdt.slice(11);
                ulhtml += ' <li onclick ="wqdetail('+j.id+')" > <div class="div1"><span style="margin:5px 10px ">' + time + '</span><span style="margin:3px 10px ">外勤</span></div><span style="margin: 10px">' + j.explain + '</span> <div class="div2"> <span>提交时间:&nbsp' + time1 + '</span>  </li>';


            }
            $("#contentul").html(ulhtml);

        }

        function wqdetail(id){

            var url='index.php?a=content&m=wq&d=we&id='+id+'';

            js.location(url);

        }

        window.onload=function(){

            load();

        }

        function GetQueryStrings(name)
        {
            var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if(r!=null)return  unescape(r[2]); return null;
        }

    </script>

</head>

<div class="element" style="width: 100%;  margin-top: 10px; overflow: auto;">

    <ul id="contentul">

    </ul>

</div>

</html>